#ifndef GAMEGLOBALS_H
#define GAMEGLOBALS_H

//3rd party stuff
#include <Box2D/Box2D.h>

//standard stuff
#include <iostream>
#include <math.h>
#include <vector>

//typedefs
typedef b2Vec2 vec2;
typedef b2Mat22 mat2;
typedef unsigned char truth;


class Camera;
struct GraphicData;
class RenderManager;
class PhysicsManager;
class ObjectManager;
class PlayerInterface;

namespace External
{
	//Variables that allow access to objects created other places in the game
	extern Camera* camera;
	extern ObjectManager* objects;
	extern RenderManager* renderer;
	extern PhysicsManager* physics;
	extern PlayerInterface* player;
}

namespace Button
{
	typedef unsigned char buttontype;
	const buttontype LEFT_DOWN = 1;
	const buttontype RIGHT_DOWN = 2;
	const buttontype MIDDLE_DOWN = 4;
	const buttontype LEFT_HELD = 8;
	const buttontype RIGHT_HELD = 16;
	const buttontype LEFT_UP = 32;
	const buttontype RIGHT_UP = 64;
	const buttontype MIDDLE_UP = 128;
}


class MainWindowInterface;
namespace Global
{
	class Window
	{
		friend class ::MainWindowInterface;
		Window():windowW(800),windowH(600){}
		Window(unsigned w, unsigned h)
			:windowW(w),windowH(h){}
		void Set(unsigned w, unsigned h)
			{ windowW = w; windowH = h; }
	public:
		unsigned GetW() { return windowW; }
		unsigned GetH() { return windowH; }
		const unsigned& GetWRef() { return windowW; }
		const unsigned& GetHRef() { return windowH; }
		vec2 GetDimensions() { return vec2(windowW, windowH); }
	private:
		unsigned windowW;
		unsigned windowH;
	};
	extern Window* GameWindow; //defined in main

	//////////////////////////////////////////////////
	//global consts
	const float PI = 3.141592f;
	const float TINY = 0.001f;
	const float ZERO = 0.000001f;

	//////////////////////////////////////////////////
	///global variables
	namespace Mouse
	{
		extern vec2 ScreenPos;
		extern vec2 WorldPos;
		extern Button::buttontype ButtonStates;
	}
	extern vec2 GameWorldSize;
	extern truth DebugState;

	//////////////////////////////////////////////////
	//global functions
	void SetDebugMode(truth state);

	//get a 0-1 float
	inline float GetRandomFloat() { return (float)(rand()%10001)/10000.0f; }

}

#endif